package com.zxw.consumer;

import com.lmax.disruptor.EventHandler;
import com.lmax.disruptor.WorkHandler;
import com.zxw.entity.ObjectEvent;

/**
 * @author by zhuxiansheng
 * @description 消费者抽象类
 * 所有的业务处理需要实现consume方法
 * @date
 */
public abstract class AbsDisruptorConsumer<T> implements EventHandler<ObjectEvent<T>>, WorkHandler<ObjectEvent<T>> {

    @Override
    public void onEvent(ObjectEvent<T> tObjectEvent, long l, boolean b) throws Exception {
        this.onEvent(tObjectEvent);
    }

    @Override
    public void onEvent(ObjectEvent<T> tObjectEvent) throws Exception {
        this.comsume(tObjectEvent.getEvent());

    }

    public abstract void comsume(T event);


}
